//
//  myView.m
//  LoginAndRegister
//
//  Created by 苗钧豪 on 16/7/16.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import "myView.h"

@implementation myView
// 重写initWithFrame方法
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // 获取自定义view的宽和高
        CGFloat viewwidth = frame.size.width;
        CGFloat viewheight = frame.size.height;
        // 获取视图内textfield的宽和高
        CGFloat textfieldwidth = viewwidth;
        CGFloat textfieldheight = viewheight;
        // 创建textfield
        self.textfield = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, textfieldwidth, textfieldheight)];
        [self addSubview:self.textfield];
    }
    return self;
}
// 实现自定义初始化方法
- (instancetype)initWithFrame:(CGRect)frame placeholder:(NSString *)placeholder borderStyle:(UITextBorderStyle)borderStyle secureTextEbtry:(BOOL)secureTextEntry keyboardType:(UIKeyboardType)keyboardType
{
    self = [self initWithFrame:frame];
    if (self) {
        self.textfield.placeholder = placeholder;
        self.textfield.borderStyle = borderStyle;
        self.textfield.secureTextEntry = secureTextEntry;
        self.textfield.keyboardType = keyboardType;
    }
    return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
